<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class MobjMoneyResource extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
                "area" => $this->company,
                "total" => set_decimal($this->getAllMoneyCount()),
                "pd1" => set_decimal($this->goods_1 * $GLOBALS['goods'][0]->price),
                "pd2" => set_decimal($this->goods_2 * $GLOBALS['goods'][1]->price),
                "pd3" => set_decimal($this->goods_3 * $GLOBALS['goods'][2]->price),
                "pd4" => set_decimal($this->goods_4 * $GLOBALS['goods'][3]->price),
                "pd5" => set_decimal($this->goods_5 * $GLOBALS['goods'][4]->price),
                "pd6" => set_decimal($this->goods_6 * $GLOBALS['goods'][5]->price),
        ];
    }
}
